﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAL;

namespace BLL
{
    public class ChiTietHoaDonNhapHang:IBUO<tbl_HoaDonNhap_Hang>
    {
        CSDLBanHangDataContext context = new CSDLBanHangDataContext();
        public bool Insert(tbl_HoaDonNhap_Hang obj)
        {
            throw new NotImplementedException();
        }

        public bool Delete(string id)
        {
            throw new NotImplementedException();
        }

        public bool Delete(tbl_HoaDonNhap_Hang obj)
        {
            throw new NotImplementedException();
        }

        public List<tbl_HoaDonNhap_Hang> GetAll()
        {
            throw new NotImplementedException();
        }

        public tbl_HoaDonNhap_Hang GetSingle(string id)
        {
            throw new NotImplementedException();
        }

        public bool Update(string id, tbl_HoaDonNhap_Hang obj)
        {
            throw new NotImplementedException();
        }

        public bool Delete(String idHDNhap, String idHang)
        {
            try
            {
                //tbl_HoaDonNhap_Hang obj = context.tbl_HoaDonNhap_Hangs.Where(n => n.id_HoaDonNhap.Trim().Equals(idHDNhap.Trim()) && n.id_Hang.Trim().Equals(idHang.Trim())).ToList<tbl_HoaDonNhap_Hang>().FirstOrDefault();
                tbl_HoaDonNhap_Hang obj = context.tbl_HoaDonNhap_Hangs.Where(n => n.id_HoaDonNhap.Trim().Equals(idHDNhap.Trim()) && n.id_Hang.Trim().Equals(idHang.Trim())).ToList<tbl_HoaDonNhap_Hang>().FirstOrDefault();
                if (obj != null)
                {
                    context.tbl_HoaDonNhap_Hangs.DeleteOnSubmit(obj);
                    context.SubmitChanges();
                    return true;
                }
                else
                {
                    return false;
                }
            }
            catch (Exception)
            {

                return false;
            }
        }
    }
}
